

// 用户ID
let id = getUrlParam("id");
$(function () {
    GetUserRole();
});
//获取用户权限
function GetUserRole() {
    // let thisdata = [];
    // thisdata.push(InitRole(id));
    let USERdata = InitRole(id);
    if (USERdata != null) {
        choose('week');
    }
    else OpenErrmsg("../../web/errhtml/404.html");
}


function InitData() {
    //接口返回数据--安全生产统计
    let data1 = { "Product_Day": "1000", "Product_Hour": "8654" };
    //接口返回数据--OSHA统计
    let data2 = { "Industrial_Disease_Qty": "100", "Microtrauma_Qty": "60", "Loss_Work_Days_Qty": "50", "Severe_Wound_Qty": "12", "Duty_Accident_Qty": "20", "NoDuty_Accident_Qty": "20" };

    //安全生产统计数据处理
    $('#Lab_DayCount').html(data1.Product_Day);
    $('#Lab_HourCount').html(data1.Product_Hour);
    //OSHA统计数据处理
    $('#lab_Industrial_Disease_Qty').html(data2.Industrial_Disease_Qty);
    $('#lab_Microtrauma_Qty').html(data2.Microtrauma_Qty);
    $('#lab_Loss_Work_Days_Qty').html(data2.Loss_Work_Days_Qty);
    $('#lab_Severe_Wound_Qty').html(data2.Severe_Wound_Qty);
    $('#lab_Duty_Accident_Qty').html(data2.Duty_Accident_Qty);
    $('#Lab_NoDuty_Accident_Qty').html(data2.NoDuty_Accident_Qty);
    $('#lab_Accident_Qty').html(parseInt(data2.NoDuty_Accident_Qty) + parseInt(data2.Duty_Accident_Qty));
}
function choose(type) {
    $('#lab_1').removeClass("labelstyleChoose");
    $('#lab_2').removeClass("labelstyleChoose");
    $('#lab_3').removeClass("labelstyleChoose");

    $('#lab_1').removeClass("labelstyle");
    $('#lab_2').removeClass("labelstyle");
    $('#lab_3').removeClass("labelstyle");

    if (type == "week") {
        $('#lab_1').addClass("labelstyleChoose");
        $('#lab_2').addClass("labelstyle");
        $('#lab_3').addClass("labelstyle");
    }
    if (type == "month") {
        $('#lab_2').addClass("labelstyleChoose");
        $('#lab_3').addClass("labelstyle");
        $('#lab_1').addClass("labelstyle");
    }
    if (type == "year") {
        $('#lab_3').addClass("labelstyleChoose");
        $('#lab_2').addClass("labelstyle");
        $('#lab_1').addClass("labelstyle");

    }
    //查询数据，刷新
    InitData(type);
}
